package com.atguigu.flink.datastreamapi.dirstribute;

import org.apache.flink.streaming.api.environment.LocalStreamEnvironment;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * Created by Smexy on 2023/4/3
 *
 *  在本地运行:
 *           LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
 *           LocalStreamEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 *
 *  打包后，部署在其他的环境下，standalone集群或yarn集群
 *             StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 *             env就是 RemoteStreamEnvironment(客户端和 集群不在一台机器)。
 *
 */
public class Demo6_Env
{
    public static void main(String[] args) {

        //智能根据当前job运行的环境返回  LocalStreamEnvironment
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        //LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();

        System.out.println(env.getClass());

        env.setParallelism(1);



        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }


}
